home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 4_0 / LIFE_SIM / VERSION_ / MAIN.C < prev    next >
C/C++ Source or Header  |  1992-03-12  |  1KB  |  56 lines

  1. /* Cell Proj 1.0 */
  2.  
  3. #include "MacProto.h"
  4. #include "Cell_Proto.h"
  5. #include "Cell_Definitions.h"
  6. #include "Cell_Variables.h"
  7.  
  8. EventRecord        gTheEvent;
  9. Boolean            gWNEImplemented, gDone;
  10. MenuHandle        gAppleMenu, gFileMenu, gAbilityMenu;
  11. WindowPtr        gCellWindow;
  12. Rect            gDragRect, gSizeRect;
  13. DialogPtr        gCellInfoDialog;
  14. long            gOverExp, gOverPop;
  15.  
  16. int                gCellStatus[ NUMBER_OF_CELLS ];
  17.  
  18. main()
  19. {
  20.     gDone = FALSE;
  21.     ToolBoxInit();
  22.     WindowInit();
  23.     DialogInit();
  24.     MenuBarInit();
  25.     SetUpDragRect();
  26.     DisplayCellWindow();
  27.     PlaceRandomCells();
  28.     MainLoop();
  29. }
  30.  
  31. MainLoop()
  32. {
  33.     while ( gDone == FALSE )
  34.     {
  35.         gWNEImplemented = ( NGetTrapAddress( WNE_TRAP_NUM, ToolTrap ) !=
  36.                             NGetTrapAddress( UMIMPL_TRAP_NUM, ToolTrap ) );
  37.         if ( gWNEImplemented )
  38.             WaitNextEvent( everyEvent, &gTheEvent, MIN_SLEEP, NIL_MOUSE_REGION );
  39.         
  40.         else
  41.         {
  42.             SystemTask();
  43.             GetNextEvent( everyEvent, &gTheEvent );
  44.         }
  45.         
  46.         DoPreCheck();
  47.         
  48.         if ( IsDialogEvent( &gTheEvent ) )
  49.         {
  50.             HandleDialog();
  51.         }
  52.         
  53.         else
  54.             HandleEvent();
  55.     }
  56. }